package org.jsola.hr.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import org.jsola.core.dto.BaseDTO;
import org.jsola.hr.entity.AttendanceDedItemDO;
import org.jsola.core.validator.Const;
import org.jsola.hr.constant.AttendStatus;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;

import static org.jsola.core.example.BaseExample.E_ID;
import static org.jsola.core.example.BaseExample.M_ID_NOT_NULL;
import static org.jsola.core.example.BaseExample.N_ID;
import static org.jsola.hr.example.AttendanceDedExample.*;
import static org.jsola.hr.example.AttendanceDedExample.E_AMOUNT_ABSENTEEISM;
import static org.jsola.hr.example.AttendanceDedExample.E_AMOUNT_MINUTE;
import static org.jsola.hr.example.AttendanceDedExample.E_COMPANY_ID;
import static org.jsola.hr.example.AttendanceDedExample.E_DED_TYPE;
import static org.jsola.hr.example.AttendanceDedExample.E_NAME;
import static org.jsola.hr.example.AttendanceDedExample.E_OVERALL_RANGE;
import static org.jsola.hr.example.AttendanceDedExample.E_PROGRAMME_ID;
import static org.jsola.hr.example.AttendanceDedExample.E_STATUS;
import static org.jsola.hr.example.AttendanceDedExample.E_TYPE;
import static org.jsola.hr.example.AttendanceDedExample.M_COMPANY_ID_MAX;
import static org.jsola.hr.example.AttendanceDedExample.M_COMPANY_ID_NOT_NULL;
import static org.jsola.hr.example.AttendanceDedExample.M_DED_TYPE_ENUM_NOT_MATCH;
import static org.jsola.hr.example.AttendanceDedExample.M_DED_TYPE_MAX;
import static org.jsola.hr.example.AttendanceDedExample.M_NAME_MAX;
import static org.jsola.hr.example.AttendanceDedExample.M_OVERALL_RANGE_MAX;
import static org.jsola.hr.example.AttendanceDedExample.M_PROGRAMME_ID_MAX;
import static org.jsola.hr.example.AttendanceDedExample.N_AMOUNT_ABSENTEEISM;
import static org.jsola.hr.example.AttendanceDedExample.N_AMOUNT_MINUTE;
import static org.jsola.hr.example.AttendanceDedExample.N_COMPANY_ID;
import static org.jsola.hr.example.AttendanceDedExample.N_DED_TYPE;
import static org.jsola.hr.example.AttendanceDedExample.N_NAME;
import static org.jsola.hr.example.AttendanceDedExample.N_OVERALL_RANGE;
import static org.jsola.hr.example.AttendanceDedExample.N_PROGRAMME_ID;
import static org.jsola.hr.example.AttendanceDedExample.N_STATUS;
import static org.jsola.hr.example.AttendanceDedExample.N_TYPE;

/**
 * @author zhr
 */
@EqualsAndHashCode(callSuper = true)
@ApiModel(description = "修改【考勤扣款设置】的参数")
@Data
public class AttendanceDedUpdateDTO extends BaseDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(notes = N_ID, example = E_ID, required = true)
    @NotNull(message = M_ID_NOT_NULL)
    private String id;

    @ApiModelProperty(notes = N_PROGRAMME_ID, example = E_PROGRAMME_ID)
    @Length(max = 32, message = M_PROGRAMME_ID_MAX)
    private String programmeId;

    @ApiModelProperty(notes = N_DED_TYPE, example = E_DED_TYPE, allowableValues = AttendStatus.VALUES_STR)
    @Length(max = 4, message = M_DED_TYPE_MAX)
    @Const(constClass = AttendStatus.class, message = M_DED_TYPE_ENUM_NOT_MATCH)
    private String dedType;

    @ApiModelProperty(notes = N_NAME, example = E_NAME)
    @Length(max = 255, message = M_NAME_MAX)
    private String name;

    @ApiModelProperty(notes = N_TYPE, example = E_TYPE)
    private Integer type;

    @ApiModelProperty(notes = N_AMOUNT_MINUTE, example = E_AMOUNT_MINUTE)
    private Integer amountMinute;

    @ApiModelProperty(notes = N_AMOUNT_ABSENTEEISM, example = E_AMOUNT_ABSENTEEISM)
    private Integer amountAbsenteeism;

    @ApiModelProperty(notes = N_OVERALL_RANGE, example = E_OVERALL_RANGE)
    @Length(max = 255, message = M_OVERALL_RANGE_MAX)
    private String overallRange;

    @ApiModelProperty(notes = N_STATUS, example = E_STATUS)
    private Boolean status;

    @ApiModelProperty(notes = N_ATTENDANCE_DED_ITEMDO_LIST, example = E_ATTENDANCE_DED_ITEMDO_LIST)
    private List<AttendanceDedItemDO> attendanceDedItemDOList = new ArrayList<>();

    @ApiModelProperty(notes = N_COMPANY_ID, example = E_COMPANY_ID, required = true)
    @NotNull(message = M_COMPANY_ID_NOT_NULL)
    @Length(max = 32, message = M_COMPANY_ID_MAX)
    private String companyId;


}

